package cn.webrx;

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Ex2 {
    public static void main(String[] args) {
        //分时问候
        //先获取系统的时间，使用if else if语句判断分支语句
        Calendar c = Calendar.getInstance();
        int h = c.get(Calendar.HOUR);
        System.out.println(h);//2 12小时

        int hh = c.get(Calendar.HOUR_OF_DAY);
        System.out.println(hh);//14 24小时 0-23

        //8:00 - 11:59
        if(hh>=8 && hh<12){
            System.out.println("上午好");
        }else if(hh>=12 && hh<14){
            System.out.println("中午好");
        }
    }
}
